package implementor;


import java.sql.SQLException;

import model.CategoryMaster;

import dao.UpdateByDao;
import dbhandelling.Crude;
import dto.UpdatedBy;

public class UpdatedByImpl extends Crude implements UpdateByDao{

	String className=new UpdatedBy().getClass().getName();
	@Override
	public void add(UpdatedBy update) throws SQLException, Exception {
		super.insert(update);
		
	}

	@Override
	public void update(UpdatedBy update) throws Exception {
		super.update(className, "updateById", update.getUpdateById()+"", "autoidUpdate", update.getAutoidUpdate()+"");
		super.update(className, "updatedTimeStamp", update.getUpdatedTimeStamp()+"", "autoidUpdate", update.getAutoidUpdate()+"");
		super.update(className, "indentId", update.getIndentId()+"", "autoidUpdate", update.getAutoidUpdate()+"");
		
	}

	@Override
	public void delete(UpdatedBy update) throws Exception {
		delete(className, "autoidUpdate", update.getAutoidUpdate()+"");
		
	}

	@Override
	public UpdatedBy retreive(String conditionField, String ConditionValue)
			throws Exception {
		UpdatedBy u=(UpdatedBy) super.retreive(className, conditionField, ConditionValue);
		return u;
	}

	@Override
	public UpdatedBy[] retreiveArray(String conditionField,
			String ConditionValue) throws Exception {
		Object[] obj=super.retreiveArrayOnCondition(className, conditionField, ConditionValue);
		UpdatedBy[] u=new UpdatedBy[obj.length];
		
		for(int i=0;i<u.length;i++)
		{
			u[i]= (UpdatedBy) obj[i];
		}
		
		return u;
		
	}

	@Override
	public UpdatedBy[] retreiveAll() throws Exception {
		Object[] obj=super.retreiveAll(className);
		UpdatedBy[] u=new UpdatedBy[obj.length];
		
		for(int i=0;i<u.length;i++)
		{
			u[i]= (UpdatedBy) obj[i];
		}
		
		return u;
	}

}
